<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0px;
            padding: 0px;
        }

        .pyramid {
            transform-style: preserve-3d;
            position: absolute;
            top: 100px;
            left: 300px;
            width: 100px;
            height: 100px;
        }

        .triangleFront {
            width: 0px;
            border-width: 0px 100px 100px 100px;
            border-color: transparent transparent cyan;
            border-style: solid;
            transform-origin: bottom;
            transform: rotateX(45deg);
        }

        .triangleRight {
            width: 0px;
            border-width: 0px 100px 100px 100px;
            border-color: transparent transparent red;
            border-style: solid;
            transform-origin: bottom;
            transform: translateX(50px) rotateY(90deg) rotateX(45deg)
        }

        .triangleBehind {
            width: 0px;
            border-width: 0px 100px 100px 100px;
            border-color: transparent transparent yellowgreen;
            border-style: solid;
            transform-origin: bottom;
            transform: translateZ(-138px) rotateX(-45deg);
        }

        .triangleLeft {
            width: 0px;
            border-width: 0px 100px 100px 100px;
            border-color: transparent transparent gold;
            border-style: solid;
            transform-origin: bottom;
            transform: translateX(-50px) rotateY(90deg) rotateX(-45deg)
        }

        .triangle {
            position: absolute;


        }

        .pyramid:hover {
            transform: rotate3d(0, 1, 0, 360deg);
            transition: 5s;


        }


        /* 四个三角,要做哪个就把他对面的border设为0,只保留他的border-color */
    </style>
</head>

<body>
    <div class="pyramid">
        <div class="triangleFront triangle">

        </div>
        <div class="triangleRight triangle">

        </div>
        <div class="triangleBehind triangle">

        </div>
        <div class="triangleLeft triangle">

        </div>

    </div>


</body>

</html>